package Thread;

import java.util.Scanner;

public class ThreadDemo11 {
  volatile  public static int count = 0;
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(()->{
           while (count == 0){

           }
            System.out.println("程序已结束");
        });
        Thread t2 = new Thread(()->{
            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入一个整数");
            count = scanner.nextInt();
        });
        t1.start();
        t2.start();
        t1.join();
        t2.join();
    }
}
